﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;

public partial class Admin_CoursewareMT : DLL.ShowLayer.BaseView
{
	private DLL.Courseware.View clsCoursewareView;
	private LinkButton lBtnDownload = new LinkButton();

	public Admin_CoursewareMT()
		: base("idTotal")
	{
		clsCoursewareView = new DLL.Courseware.View(Page);

		clsView = clsCoursewareView;

		tfOperation.HeaderStyle.Width = 100;

		lBtnDownload.Text = "下载";
		lBtnDownload.CommandName = "Download";
		lBtnDownload.ID = "201408241850";
		AddGridViewOperation(lBtnDownload);
		AddTableColumn(new TonyNet4V1.Structs.TableShowColumn("名称", "Name"));
	}

	protected void Page_Load(object sender, EventArgs e)
	{

	}

	protected override void OnInit(EventArgs e)
	{
		base.OnInit(e);

		gvTable.RowCommand += new GridViewCommandEventHandler(gvTable_RowCommand);
		gvTable.RowDataBound += new GridViewRowEventHandler(gvTable_RowDataBound);
	}

	void gvTable_RowDataBound(object sender, GridViewRowEventArgs e)
	{
		GridView gv = new GridView();

		gv = (GridView)sender;

		if (e.Row.RowIndex >= 0)
		{
			LinkButton lBtn = new LinkButton();

			lBtn = (LinkButton) e.Row.FindControl(lBtnDownload.ID);

			//lBtn =(LinkButton)gv.Rows[e.Row.RowIndex].FindControl(lBtnDownload.ID);
			lBtn.CommandArgument = ((GridView)sender).DataKeys[e.Row.RowIndex].Value.ToString();
		}
	}

	void gvTable_RowCommand(object sender, GridViewCommandEventArgs e)
	{
		if (e.CommandName == "Download")
		{
			TonyNet4V1.ShowMessageAlert.ShowMessage(Page, e.CommandArgument.ToString());
			// 显示下载网页
		}
	}
}